<include file="Public/common" />
<block>
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css"  media="all">
    <style>
        .col-xs-3{margin-top:5px;}
        .col-xs-4{
            text-align: center;
            height: 34px;
            width: 35%;
            line-height: 34px;
            width: 35%!important;
        }
        .col-xs-8{
            width: 63%!important; 
        }
         .margin-top0{
            margin-top: 0px!important;
        }
        th{text-align: center;}
    </style>
</block>
<block name="content">
    <div class="page-header"><h1>首页 &gt;商家管理 > 分销商列表</h1></div>
    <form action="" method="get" >
        <div class="col-xs-12 ">
            <div class="col-xs-3">
                <label for="" class="col-xs-4">分销商编号:</label>
                <div class="col-xs-8 text-left"><input type="text" class="form-control" name="reseller_sn" placeholder="请输分销商编号" value="{$post.reseller_sn}" /></div>
            </div>
            <div class="col-xs-3">
                <label for="" class="col-xs-4">分销商名称:</label>
                <div class="col-xs-8 text-left"><input type="text" class="form-control" name="reseller_name" placeholder="请输入分销商名称"  value="{$post.reseller_name}"/></div>
            </div>
            <div class="col-xs-3" style="display: none;">
                <label for="" class="col-xs-4">状态:</label>
                <div class="col-xs-8 text-left">
                    <select class="form-control" name="status" id="">
                        <option value="1" <if condition="$post['status'] eq 1">selected</if> >合作</option>
                        <option value="-1" <if condition="$post['status'] eq -1">selected</if>>停止合作</option>
                    </select>
                </div>
            </div>

            <!-- <div class="col-xs-3">
                 <label for="" class="col-xs-4">合作开始时间:</label>
                 <div class="col-xs-8 text-left"><input id="start_time" name="start_time" value="{$post.start_time}" type="text" readonly class="form-control day" placeholder="合作开始时间" /></div>

             </div>

             <div class="col-xs-3">
                 <label for="" class="col-xs-4">合作结束时间:</label>
                 <div class="col-xs-8 text-left"><input type="text" name="end_time" id="end_time"  value="{$post.end_time}" readonly class="form-control day" placeholder="合作结束时间" /></div>
             </div>-->

            <div class="col-xs-3 margin-top0">
                <input class="btn btn-primary" type="submit" value="查询"/>
            </div>
        </div>

        <div class="col-xs-12"  style="margin-top:10px;">
            <!--  <button class="btn btn-primary btn-xs pull-right" style="margin-right: 10px">添加新的分销商</button>-->
            <if condition="checkAuth('Operator/Shops/lineResellerExportExcel')">
                <a class="btn btn-primary btn-xs pull-right" style="margin-right: 10px" href="{:U('lineResellerExportExcel')}">导出</a>
            </if>
        </div>

    </form>

    <table class="table table-striped table-bordered table-hover table-condensed text-center">
        <thead>
        <tr>
            <th class="filtrate_1" >分销商名称</th>
            <th class="filtrate_2" >分销商账号</th>
            <th class="filtrate_3" >分销商编号 <!--<input type="checkbox" class="checkAll">--></th>
            <th class="filtrate_4" >移动电话</th>
            <th class="filtrate_5" >联系人</th>
            <th class="filtrate_6" >地址</th>
            <th class="filtrate_7" >有效时间</th>
            <th class="filtrate_8" >截止时间</th>
            <th class="filtrate_9" >注册时间</th>
            <th class="filtrate_10" >服务等级</th>
            <th class="filtrate_11" >帐户状态</th>
            <th class="filtrate_13" >审核状态</th>
            <th class="filtrate_12"  style="width:180px">操作</th>
        </tr>
        </thead>
        <tbody>
        <volist name="list" id="vo">
            <tr >
                <td class="filtrate_1" >{$vo.reseller_name} <!--<input type="checkbox" class="chk">--></td>
                <td class="filtrate_2">{$vo.reseller_account}</td>
                <td class="filtrate_3">{$vo.reseller_sn}</td>
                <td class="filtrate_4">{$vo.reseller_phone}</td>
                <td class="filtrate_5">{$vo.linkman}</td>
                <td class="filtrate_6">{$vo.complete_address}</td>
                <td class="filtrate_7">{$vo.start_time|date='Y-m-d',###}</td>
                <td class="filtrate_8">{$vo.end_time|date='Y-m-d',###}</td>
                <td class="filtrate_9">{$vo.create_time|date='Y-m-d',###}</td>
                <td class="filtrate_10">{$vo.service_level}</td>
                <td class="filtrate_11">
                    <switch name="vo.reseller_status">
                        <case value="1">开通</case>
                        <case value="-1">锁定</case>
                    </switch>
                </td>
                <td class="filtrate_13">
                    <switch name="vo.is_review">
                        <case value="1">已通过</case>
                        <case value="-1">待审核</case>
                        <case value="-2">已拒绝</case>
                    </switch>
                </td>
                <td class="filtrate_12">
                    <if condition="checkAuth('Operator/Shops/addResellerShops')">
                        <a href="{:U('addResellerShops',array('id'=>$vo['reseller_id']))}" class="btn btn-xs btn-primary">编辑</a>
                    </if>
                    <if condition="checkAuth('Operator/Shops/changeresellerStatusById')">
                        <if condition="$vo['reseller_status'] eq 1">
                            <a href="{:U('changeresellerStatusById',array('id'=>$vo['reseller_id'],'reseller_status'=>-1))}" class="btn btn-xs btn-warning">锁定</a>
                            <else/>
                            <a href="{:U('changeresellerStatusById',array('id'=>$vo['reseller_id'],'reseller_status'=>1))}" class="btn btn-xs btn-primary">开通</a>
                        </if>
                    </if>
                </td>
            </tr>
        </volist>

        <tr>
            <td colspan="13">
                <!--分页样式-->
                <ul class="pagination">
                    {$show}
                </ul>
            </td>
        </tr>
        </tbody>
    </table>

</block>
<block name="js">
    <script src=""></script>
    <script src="__STATIC__/layui/layui.all.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script>
        /**
         * 打开订单详情页面
         * @param  {[int]}    orderId     [订单id]
         */

        //筛选显示
        $('body').on('change','.filtrate',function () {
            var id=$(this).val();
            if($(this).is(':checked')){
                $('.filtrate_'+id).show();
            }else{
                $('.filtrate_'+id).hide();
            }
        });


        layui.use('laydate', function() {
            var laydate = layui.laydate;
            //常规用法
            laydate.render({
                elem: '#start_time'
            });
            laydate.render({
                elem: '#end_time'
            });
        })

        /**
         *订单详情
         * @param orderId
         */

        function openDetail(orderId){
            layer.open({
                type: 2,
                offset:20,
                area: ['90%','90%'],
                title: '订单详情',
                content: '{:U("Orders/detail")}',
            })
        }
    </script>
</block>
